// 枚举类
// 1.创建一个Color枚举类
// 2.有 RED,BLUE,BLACK,YELLOW,GREEN这个五个枚举值/对象;
// 3Color有三个属性redValue，greenValue，blueValue,
// 4创建构造方法，参数包括这三个属性，
// 5每个枚举值都要给这三个属性赋值，三个属性对应的值分别是
// 6red:255,0,0 blue:0,0,255 black:0,0,0 yellow:255,255,0 green:0,255,0
// 7>定义接口，里面有方法show，要求Color实现该接口
// 8?show方法中显示三属性的值
// 9将枚举对象在switch语句中匹配使用
public class exercise08 {
    public static void main(String[] args) {
        String color = "颜色";
        switch (color) {
            case "红":
                Color.RED.show();
                break;
            case "蓝":
                Color.BLUE.show();
                break;
            case "黑":
                Color.BLACK.show();
                break;
            case "黄":
                Color.YELLOW.show();
                break;
            case "绿":
                Color.GREEN.show();
                break;
            default:
                System.out.println("没有匹配到");;
        }
    }

}

enum Color implements J{
    RED(255,0,0),
    BLUE(0,0,255),
    BLACK(0,0,0),
    YELLOW(255,255,0),
    GREEN(0,255,0);

    private int redValue;
    private int greenValue;
    private int blueValue;

    private Color(int x,int y,int z){
        this.redValue = x;
        this.greenValue = y;
        this.blueValue = z;
    }

    @Override
    public void show(){
        System.out.println(this.redValue + "," + this.greenValue + "," + this.blueValue);
    }
}

interface J{
    void show();
}

